﻿using Compass.Wasm.Shared;
using Compass.Wasm.Shared.Categories;
using Compass.Wasm.Shared.Data.Hoods;
using System.Collections.Generic;

namespace Compass.Wpf.ApiServices.Categories;

public interface IDrawingNumberService : IBaseService<DrawingNumberDto>
{
    Task<ApiResponse<List<DrawingNumberDto>>> GetAllByKeywordAsync(string keyword);
}

public class DrawingNumberService:BaseService<DrawingNumberDto>,IDrawingNumberService
{
    private readonly HttpRestClient _client;
    private const string ServiceName = "DrawingNumber";
    public DrawingNumberService(HttpRestClient client) : base(client,ServiceName )
    {
        _client = client;
    }

    public async Task<ApiResponse<List<DrawingNumberDto>>> GetAllByKeywordAsync(string keyword)
    {
        var request = new BaseRequest
        {
            Method = RestSharp.Method.Get,
            Route = $"api/{ServiceName}/Keyword?keyword={keyword}"
        };
        return await _client.ExecuteAsync<List<DrawingNumberDto>>(request);
    }
}